#include <iostream>
#include<cmath>
#include <vector>
#include <algorithm>
#include <queue>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
ll a,b,c,n;
ll pi[50];
void init(){
	pi[0]=1;
	for(int i=1;i<=31;i++) pi[i]=pi[i-1]*2;
}
void solve(){
	cin>>a>>b>>c;
	ll ans=1e18;
	for(int i=0;i<=31;i++){
		ans=min(ans,i*a+b*(ll)ceil(1.0*c/pi[i]));
	}
	cout<<ans<<'\n';
}
int main()
{
	IOS;
	init();
	int t=1;
	cin>>t;
	while(t--) solve();
	return 0; 
}
